package com.example.demo.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.Message;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface MessageDao extends BaseMapper<Message> {
    @Select("SELECT m.*, u.username as user FROM message m JOIN user u ON m.user_id = u.id WHERE m.room_id = #{id}")
    List<Map<String, Object>> getMessagesByRoomId(long id);
}
